package com.qriver.cloud.provider;

import com.qriver.cloud.service.SendMsgService;
import com.sun.istack.internal.logging.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class ProviderController {

    Logger logger = Logger.getLogger(ProviderController.class);
    @Autowired
    private SendMsgService sendMsgService;

    @RequestMapping("/produce")
    @ResponseBody
    public String produce(String name) {
        logger.info("调用服务提供者ProviderController的produce()方法！");
        sendMsgService.sendMsg(name == null ? "World!" : name);
        return "消息发送成功！";
    }

}
